
var columns = [
    {
        field: 'index',
        title: '序号',
        align:"center",
        formatter:function(value, row, index){
            return index+1;
        }
    },{
        field: 'roleName',
        align: 'center',
        title: '角色名称'
    },{
        field: 'desc',
        align: 'center',
        title: '角色介绍'
    },{
        field: 'state',
        align: 'center',
        title: '是否启用',
        formatter: function (value, row, index) {
            return pubSwitch.getSwitchBtnCss(row);
        }
    },{
        field: 'operator',
        title: '操作',
        align: 'center',
        formatter: function (value, row, index) {
            return pubOptBtn.getOptBtn('role',menu,row.id);
        }
    }];

var role={
     roleInit:function() {
         pubOptBtn.getHeadBtn("p","#toolbar","role",menu);
         pubForm.getBootTable("#tableList","/role/queryRoleList","/role/updateState");
     },
    showRoleDetPage:function (roleId) {
        loadUtil = new Load($);
        loadUtil.load({
            container:'#homeContent',
            url: application.contextPath+"/role/showRoleDetPage?roleId="+roleId
        });
    },
     showOperationPage:function (roleId) {
         loadUtil = new Load($);
         loadUtil.load({
             container:'#homeContent',
             url: application.contextPath+"/role/showOperationPage?roleId="+roleId
         });
     },
    //打开添加页面
    showAddObjPage:function () {
         $.ajax({
             url: application.contextPath+"/role/showAddRolePage",
             type:"GET",
             success:function(res){
                 layer.open({
                     type:1,
                     title:'角色管理',
                     content:res,
                     maxmin:true,//最大，最小开关
                     shade:0.5,//遮盖层模糊度
                     anim:1,//打开跟关闭动画
                     scrollbar:true,//是否设置滚轮
                     area:["880px","550px"]
                 })
             }
         });
    },
    delRole:function (roleId) {
        pubForm.delRow(roleId,"/role/delRole","/role/queryRoleList","#tableList");
    }
};

$(document).ready(function(){
    role.roleInit();
});